export function searchColumns() {
  return [
    {
      prop: 'country_id',
      type: 'select',
      dicData: this.countryList,
      filterable: true,
      props: {
        label: 'full_name',
        value: 'id',
      },
      typeformat(row) {
        return `(${row?.short_name}) ${row?.full_name}`
      },
      placeholder: '请选择国家',
    },
    {
      prop: 'status',
      type: 'select',
      dicData: [
        { value: 1, label: '开启' },
        { value: 2, label: '关闭' },
      ],
      filterable: true,
      props: {
        value: 'value',
        label: 'label',
      },
      placeholder: '请选择活动动态',
    },
    {
      prop: 'page_type',
      type: 'select',
      dicData: [
        { value: 0, label: 'Top Up' },
        { value: 1, label: '弹窗充值' },
      ],
      filterable: true,

      placeholder: '请选择展示页面',
    },
  ]
}

export function tableColumns() {
  const status = [
    { value: 0, label: 'Top Up' },
    { value: 1, label: '弹窗充值' },
  ]
  return [
    {
      label: '序号',
      prop: 'id',
      width: 80,
    },
    {
      label: '方案名称',
      prop: 'name',
      align: 'left',
      width: 200,
    },
    {
      label: '展示页面',
      prop: 'page_type',
      formatter: row => status[row?.page_type]?.label,
    },
    {
      label: '适用国家',
      prop: 'country_name',
      width: 200,
    },
    {
      label: '活动名称',
      prop: 'activity_names',
      align: 'left',
      formatter: row => row?.activity_names?.join(','),
    },
    {
      label: '首选活动',
      prop: 'first_activity_name',
    },
    {
      label: '方案状态',
      prop: 'status',
      html: true,
      width: 80,
      formatter: row =>
        `<span class="${row?.status === 1 ? 'text-success' : 'text-danger'}">${
          row?.status === 1 ? '开启' : '关闭'
        }</span>`,
    },
    {
      label: '最近一次操作时间',
      prop: 'updated_at',
      width: 140,
      formatter: row => this.$formatTime(row?.updated_at),
    },
  ]
}
